﻿using System;
using System.Web.UI.WebControls;

namespace MyLib.Web.UI {
	/// <summary>
	/// 
	/// </summary>
	public class MyDateParameter : Parameter {
		/// <summary>
		/// 
		/// </summary>
		/// <param name="context"></param>
		/// <param name="control"></param>
		/// <returns></returns>
		protected override object Evaluate(System.Web.HttpContext context, System.Web.UI.Control control) {
			if (string.IsNullOrEmpty(DefaultValue)) {
				return new DateTime();
			} else {
				DateTime dt;
				if (DateTime.TryParse(DefaultValue, out dt))
					return dt;
				else
					return new DateTime();
			}
		}
	} // end of MyDateParameter.
}
